package cn.edu.qzuie.artist.module.td.dal.mysql.school;

import java.util.*;

import cn.edu.qzuie.artist.framework.common.pojo.PageResult;
import cn.edu.qzuie.artist.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.edu.qzuie.artist.framework.mybatis.core.mapper.BaseMapperX;
import cn.edu.qzuie.artist.module.td.dal.dataobject.school.SchoolDO;
import org.apache.ibatis.annotations.Mapper;
import cn.edu.qzuie.artist.module.td.controller.admin.school.vo.*;

/**
 * 学校 Mapper
 *
 * @author 泉信管理员
 */
@Mapper
public interface SchoolMapper extends BaseMapperX<SchoolDO> {

    default PageResult<SchoolDO> selectPage(SchoolPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SchoolDO>()
                .likeIfPresent(SchoolDO::getSchoolName, reqVO.getSchoolName())
                .eqIfPresent(SchoolDO::getAddress, reqVO.getAddress())
                .eqIfPresent(SchoolDO::getEnable, reqVO.getEnable())
                .eqIfPresent(SchoolDO::getRegionId, reqVO.getRegionId())
                .orderByDesc(SchoolDO::getId));
    }

}